cmake_minimum_required(VERSION 2.8.7)
include(ExternalProject)
project(jjpeg_all_platform)


set(SRC_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}/jpeg)

set(WIN32_TOOLCHAIN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchain-cross-mingw32-win32.cmake)
set(WIN64_TOOLCHAIN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchain-cross-mingw32-win64.cmake)

#add_subdirectory(jpeg)


set(PLATFORM_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../classes/)

ExternalProject_Add(mac
        URL ${SRC_PROJECT}
        PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mac
        CMAKE_ARGS  -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX=${PLATFORM_OUTPUT}/darwin
        )


ExternalProject_Add(win64
        URL ${SRC_PROJECT}
        PREFIX ${CMAKE_CURRENT_BINARY_DIR}/win64
        CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${WIN64_TOOLCHAIN} -DCMAKE_INSTALL_PREFIX=${PLATFORM_OUTPUT}/win32-x86-64
        )

ExternalProject_Add(win32
        URL ${SRC_PROJECT}
        PREFIX ${CMAKE_CURRENT_BINARY_DIR}/win32
        CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${WIN32_TOOLCHAIN} -DCMAKE_INSTALL_PREFIX=${PLATFORM_OUTPUT}/win32-x86
        )